<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header">

</head>
<style>
	.main{
        margin: 16px 0 0 0;
        width:100%;
        height:auto;
    }
    .name{
        font-size: 14px;
        font-weight: bold;
        margin-top: 16px;
        height: 48px;
        line-height: 48px;
        padding-left: 16px;
        color: #3F4F60;
        border-radius: 4px;
        background: #fff;
    }
    .echart-box{
        background: #fff;
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 4px;
    }
    .echart-box{
        clear: both;
        overflow: hidden;
    }
    .echart-box .item{
        float: left;
        width: 31%;
        margin-right: 2.333%;
        border-radius: 4px;
    }
    .echart-box .tit{
        font-size: 18px;
        margin-bottom: 24px;
        color: #06172A;
        position: relative;
        font-weight: bold;
        padding-left: 12px;
    }
    .echart-box .tit:after{
        content: '';
        width: 4px;
        height: 18px;
        background: var(--buttonborder);
        position: absolute;
        left: 0;
        top: 50%;
        margin-top: -8px;
    }
    .echart-box .text{
        color: #5a5f72;
        margin: 8px 0;
        position: relative;
        padding-left: 10px;
     }
    .echart-box .text:after{
        content: '';
        width: 4px;
        height: 14px;
        background: #2C82EB;
        position: absolute;
        left: 0;
        top: 50%;
        margin-top: -7px;
    }
    .echart-box .num{
        font-size: 30px;
        font-size: bold;
        padding-bottom: 8px;
        border-bottom: 1px solid #ccc;
    }
    .echart-box-two{
        background: #fff;
        padding: 18px;
    }
    .echart-box-two .item{
        background: #fff;
    }
    #intervalScoreEcharts{
        padding-top: 20px;
        height:456px;
        border: 1px solid var(--buttonborder);
        border-radius: 4px
    }
    #mydiv1{
        flex-direction: var(--columnAndReverse);
    }
</style>
<body class="gray-bg" style="margin-right: 10px">
<div class="wrapper wrapper-content ">
    <p class="name">全国职业院校技能大赛中等职业教育 -- 婴幼儿照护赛项</p>
    <div id="main" class="main">
        <div class="echart-box-two echart-box">
            <div class="item" style="width: 100%">
                <p class="tit">得分区间分布图（百分制）</p>
                <div  id="mydiv1" style="display: flex; ">
                <div id="intervalScoreEcharts"></div>
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th></th>
                        <th>0-60分</th>
                        <th>61-70分</th>
                        <th>71-80分</th>
                        <th>81-90分</th>
                        <th>90-100分</th>
                    </tr>
                    </thead>
                    <tbody id="mytabody">
                    </tbody>
                </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript" type="text/javascript" >
    let mydata=``,series=[],color=[],myChart1=null
    //获取
    let themeValue=[[${themeValue}]]
    switch (themeValue) {
        case '1':
            color=['#c205fa','#0547f5','#ff0404','#02fc63','#cecece']
            break;
        case '2':
            color=['#ba70d0','#5d7ed5','#f36969','#51af78','#cecece']
            break;
    }
    $(function() {

        $.ajax({
            url: "/recordPoints/proportionOfTotalScore",
            type: "get",
            data: {
            },
            success: function (res) {
                if(res==null){
                    layer.msg("未查询到数据！");
                }
                else {

                    for (let i = 0; i < res.data.data.length; i++) {
                        let item=res.data.data[i]
                        mydata+=`<tr>
                            <td>${item.field}</td>
                            <td>${item.takeScore60}</td>
                            <td>${item.takeScore70}</td>
                            <td>${item.takeScore80}</td>
                            <td>${item.takeScore90}</td>
                            <td>${item.takeScore100}</td>
                          </tr>`
                        series.push(  {
                            name: item.field,
                            type: 'line',
                            color: color[i],
                            symbol:'none',
                            smooth:true,
                            data: [item.takeScore60,item.takeScore70,item.takeScore80,item.takeScore90,item.takeScore100],
                        },)

                    }
                    $('#mytabody').html(mydata)
                    intervalScoreEcharts(series) //得分区间分布图（百分制）

                }
            }
        });

        window.onresize=()=>{
            myChart1?.resize()
        }

    })
    function intervalScoreEcharts(series){
        var dom = document.getElementById("intervalScoreEcharts");
        myChart1 = echarts.init(dom);
        var option;
        option = {
            tooltip: {
                trigger: 'axis',
                formatter: function (params) {
                    let mytooltip=''
                    for (let i = 0; i < params.length; i++) {
                        let item=params[i]
                        mytooltip+=`${item.seriesName}-${option.xAxis.data[item.dataIndex]}：${item.value}<br/>`
                    }
                    return mytooltip
                },
            },
            legend: {//图例
                show:true,
                x : 'center',
                y : 'bottom',
                itemHeight: 12,
                icon: 'circle',
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '10%',
                containLabel: true
            },
            xAxis: {
                show:false,
                type: 'category',
                boundaryGap: true,
                data:['0-60分','61-70分','71-80分','81-90分','90-100分'
                ]
            },
            yAxis: {
                type: 'value',
            },
            series
        };
        if (option && typeof option === 'object') {
            myChart1.setOption(option);
        }
    }

</script>
</body>
</html>